package com.cg.service;

import com.cg.context.UserContext;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
@AllArgsConstructor
@Slf4j
public class DemoServiceImpl implements DemoService {

    @Async("async-executor-spring")
    @Override
    public void asyncExecute() {
        log.info("调用异步方法后 asyncExecute -----> userId = {}, userName = {}, userPhone = {}",
                UserContext.getUserId(), UserContext.getUserName(), UserContext.getUserPhone());
    }
}
